package org.smr.dev;

import org.smr.dev.dao.DaoCodeGenerator;
import org.smr.dev.javabean.JavaBeanCodeGenerator;
import org.smr.dev.mybatis.mapper.MapperCodeGenerator;
import org.smr.dev.serviceimpl.ServiceImplementsCodeGenerator;

public class Main {
	
	
	public static void main(String[] args) {
		
		String tableName = "ym_stat_task";
		
		String javaBeanName = TableStructUtils.tableName2BeanName(tableName);
		
		CodeGenerator javaBeanCode = new JavaBeanCodeGenerator("javaBeanTemplate.vm", javaBeanName + ".java");
		javaBeanCode.generate(tableName);
		
		
		CodeGenerator mapperCode = new MapperCodeGenerator("mapperFileTemplate.vm", javaBeanName +"Mapper.xml");
		
		mapperCode.generate(tableName);
		
		CodeGenerator daoCodeGenerator = new DaoCodeGenerator("daoTemplate.vm",  javaBeanName +"Mapper.java");

		daoCodeGenerator.generate(tableName); 
		
		CodeGenerator serviceCodeGenerator = new DaoCodeGenerator("serviceTemplate.vm",  javaBeanName +"Service.java");

		serviceCodeGenerator.generate(tableName);
		
		CodeGenerator controllerCodeGenerator = new DaoCodeGenerator("controllerTemplate.vm",  javaBeanName +"Controller.java");

		controllerCodeGenerator.generate(tableName);

		CodeGenerator serviceImplementsCodeGenerator = new ServiceImplementsCodeGenerator("serviceImplementsTemplate.vm",  javaBeanName +"ServiceImpl.java");

		serviceImplementsCodeGenerator.generate(tableName);
	}

}
